From 4536b32f7c1cdd366b4a2d052088a13e761db789 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 9 Jan 2006 11:31:19 +0100 Subject: [PATCH] Allow HYPERVISOR_VIRT_START/END public definitions to be used in assembly files. Check that the public and private definitions of these constants match up at run time. Signed-off-by: Keir Fraser --- xen/arch/x86/boot/x86_32.S | 4 ++-- xen/arch/x86/setup.c | 6 ++++++ xen/include/asm-x86/config.h | 6 ++---- xen/include/public/arch-x86_32.h | 11 ++++++++--- xen/include/public/arch-x86_64.h | 7 +++++-- xen/include/public/xen.h | 9 +++++++++ xen/include/xen/config.h | 9 +++++++++ 7 files changed, 41 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/boot/x86_32.S b/xen/arch/x86/boot/x86_32.S index b98e1c72bc..5534b2621b 100644 --- a/xen/arch/x86/boot/x86_32.S +++ b/xen/arch/x86/boot/x86_32.S @@ -100,7 +100,7 @@ __start: 1: stosl /* low mappings cover as much physmem as possible */ add $4,%edi add $(1< PAGE_SIZE); BUG_ON(sizeof(vcpu_info_t) != 64); + /* __foo are defined in public headers. Check they match internal defs. */ + BUG_ON(__HYPERVISOR_VIRT_START != HYPERVISOR_VIRT_START); +#ifdef HYPERVISOR_VIRT_END + BUG_ON(__HYPERVISOR_VIRT_END != HYPERVISOR_VIRT_END); +#endif + init_frametable(); end_boot_allocator(); diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h index 960e381f1f..ca4410a5a0 100644 --- a/xen/include/asm-x86/config.h +++ b/xen/include/asm-x86/config.h @@ -248,12 +248,10 @@ extern unsigned long _end; /* standard ELF symbol */ #ifdef CONFIG_X86_PAE /* Hypervisor owns top 168MB of virtual address space. */ -# define __HYPERVISOR_VIRT_START 0xF5800000 -# define HYPERVISOR_VIRT_START (0xF5800000UL) +#define HYPERVISOR_VIRT_START mk_unsigned_long(0xF5800000) #else /* Hypervisor owns top 64MB of virtual address space. */ -# define __HYPERVISOR_VIRT_START 0xFC000000 -# define HYPERVISOR_VIRT_START (0xFC000000UL) +#define HYPERVISOR_VIRT_START mk_unsigned_long(0xFC000000) #endif #define L2_PAGETABLE_FIRST_XEN_SLOT \ diff --git a/xen/include/public/arch-x86_32.h b/xen/include/public/arch-x86_32.h index 9d7b69f694..b4372da204 100644 --- a/xen/include/public/arch-x86_32.h +++ b/xen/include/public/arch-x86_32.h @@ -49,10 +49,15 @@ * machine->physical mapping table starts at this address, read-only. */ #ifdef CONFIG_X86_PAE -# define HYPERVISOR_VIRT_START (0xF5800000UL) +#define __HYPERVISOR_VIRT_START 0xF5800000 #else -# define HYPERVISOR_VIRT_START (0xFC000000UL) +#define __HYPERVISOR_VIRT_START 0xFC000000 #endif + +#ifndef HYPERVISOR_VIRT_START +#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) +#endif + #ifndef machine_to_phys_mapping #define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START) #endif @@ -137,7 +142,7 @@ typedef struct { unsigned long pad[5]; /* sizeof(vcpu_info_t) == 64 */ } arch_vcpu_info_t; -#endif +#endif /* !__ASSEMBLY__ */ #endif diff --git a/xen/include/public/arch-x86_64.h b/xen/include/public/arch-x86_64.h index 5e3b6a7671..ea8af05c6e 100644 --- a/xen/include/public/arch-x86_64.h +++ b/xen/include/public/arch-x86_64.h @@ -59,9 +59,12 @@ /* And the trap vector is... */ #define TRAP_INSTR "syscall" +#define __HYPERVISOR_VIRT_START 0xFFFF800000000000 +#define __HYPERVISOR_VIRT_END 0xFFFF880000000000 + #ifndef HYPERVISOR_VIRT_START -#define HYPERVISOR_VIRT_START (0xFFFF800000000000UL) -#define HYPERVISOR_VIRT_END (0xFFFF880000000000UL) +#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) +#define HYPERVISOR_VIRT_END mk_unsigned_long(__HYPERVISOR_VIRT_END) #endif /* Maximum number of virtual CPUs in multi-processor guests. */ diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index 3aa683c018..ddc901bc9a 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -426,6 +426,15 @@ typedef uint64_t cpumap_t; typedef uint8_t xen_domain_handle_t[16]; +/* Turn a plain number into a C unsigned long constant. */ +#define __mk_unsigned_long(x) x ## UL +#define mk_unsigned_long(x) __mk_unsigned_long(x) + +#else /* __ASSEMBLY__ */ + +/* In assembly code we cannot use C numeric constant suffixes. */ +#define mk_unsigned_long(x) x + #endif /* !__ASSEMBLY__ */ #endif /* __XEN_PUBLIC_XEN_H__ */ diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h index e59bb86a7c..519dd4a3e5 100644 --- a/xen/include/xen/config.h +++ b/xen/include/xen/config.h @@ -43,4 +43,13 @@ #define __STR(...) #__VA_ARGS__ #define STR(...) __STR(__VA_ARGS__) +#ifndef __ASSEMBLY__ +/* Turn a plain number into a C unsigned long constant. */ +#define __mk_unsigned_long(x) x ## UL +#define mk_unsigned_long(x) __mk_unsigned_long(x) +#else /* __ASSEMBLY__ */ +/* In assembly code we cannot use C numeric constant suffixes. */ +#define mk_unsigned_long(x) x +#endif /* !__ASSEMBLY__ */ + #endif /* __XEN_CONFIG_H__ */ -- 2.30.2